<style>
    /* 支付方式 */
    .p-list {
        display: flex;
        align-items: center;
        padding: 10px 0;
        margin: 0 10px;
        border-bottom: 1px solid #eee;
        font-size: 14px;
        color: #555555;
    }

    .p-list:last-child {
        border-bottom: none;
    }

    .p-list.active {
        background-image: url('../image/select2.png');
        background-repeat: no-repeat;
        background-size: 20px 20px;
        background-position: 100% center;
    }

    .p-list img {
        width: 20px;
        margin-right: 10px;
    }

    html,
    body {
        background: #eee;
    }

    .money {
        border-top: 1px solid #eee;
        border-bottom: 1px solid #eee;
    }
</style>

<div class="wrap" id="view" v-cloak>
    <div class="top-wrap w-bg new-padding-10">
        <div class="my-money font-n new-padding-tb-10"> 你可提现的金额为: {{myMoney}}元 </div>
        <div class="flex-bt font-n new-padding-tb-10 money">
            <input type="text" placeholder="请输入提现金额" id="js-money">
            <span>元</span>
        </div>
        <div class="tip font-s new-margin-t-10">
            提现处理时间为周一到周五09:00-18:00,1-3个工作日到账。将遇到问题可联系客服：
            <span>客服微信：<span style="color: #2196f3;" v-for="i in wx" @click="copyTxt(i)">{{i}}&nbsp;&nbsp;</span></span>
        </div>
    </div>

    <p class="title new-padding-10 font-s">我的提现账号</p>
    <ul class="pay-wrap w-bg">
        <li class="p-list zfb flex-bt" data-type=1 onclick="changePay()">
            <div class="flex">
                <img src="../image/pay/zfb.png" alt="">
                <span>支付宝</span>
            </div>
            <span>{{ffInfo.zhifucount}}</span>
        </li>
    </ul>
    <p class="title new-padding-10 font-s">提现方式</p>
    <ul class="pay-wrap w-bg">
        <li class="p-list zfb active" data-type=1>
            <img src="../image/pay/zfb.png" alt="">
            <span>支付宝</span>
        </li>
        <!-- <li class="p-list" data-type=2  onclick="selectPay(this)">
                <img src="../image/pay/wx.png" alt="">
                <span>微信</span>
            </li> -->
    </ul>
    <button class="new-submit" onclick="submit()">提现</button>
    <div id="js-modal"></div>
</div>
<script src="../script/copy.js?v=1.0.1"></script>
<script>
    var view = new Vue({
        el: '#view',
        data: {
            imgurl: imgurl,
            ffList: [],
            ffInfo: {},
            myMoney: 0,
            wx: [], // 微信客服
        },
        methods: {
            _url: function (param, url) {
                _url(param, url);
            },
            // 复制
            copyTxt: function (text) {
                copyTxt(text)
            },
        }
    })

    getMyMoney();
    getService();

    // 获取余额
    function getMyMoney() {
        _ajax('user_volley.php', function (ret, err) {
            _log(JSON.stringify(ret));
            _log(JSON.stringify(err));
            if (ret && ret.code == 200) {
                view.myMoney = ret.volley;
                getUserInfo();
            }
        }, {
            user_id: myuserid,
        })
    }

    // 获取提现账号信息
    function getUserInfo() {
        _getUser(function (ret) {
            view.ffInfo = ret.result;
        })
        
    }
    judgeLogin()
    // 提现
    function submit() {
        var money = $.trim($('#js-money').val());
        if (isNaN(Number(money)) || Number(money) <= 0) {
            _msg('请输入提现金额');
            return;
        }
        if (Number(money) > view.myMoney) {
            _msg('超出余额');
            return;
        }
        changePay('frame4/go_pay')
    }

    // 修改提现信息
    function changePay(n) {
        if (!parseInt(view.ffInfo.paypwd)) {
            var name = 'frame4/paypwd';
        } else {
            var name = 'frame4/change_pay';
        }
        name = n ? n : name;
        $('#js-modal').removeClass('new-hide');
        _load('#js-modal', name)
    }

    // 关闭模态框
    function closeMoneyFrm() {
        $('#js-modal').addClass('new-hide');
    }

    // 获取官方联系方式
    function getService() {
        _ajax('home/user/customService', function (ret) {
            if (ret && ret.code == 200) {
                view.wx = ret.result.wechat;
            }
        })
    }
</script>